package org.netEase.util;

public class pageBeandetails {
	private int pageNo = 1; //褰撳墠椤�
	
	private int size = 8; //姣忛〉鏄剧ず鐨勬暟鎹潯鏁�
	
	private int nextPage; //涓嬩竴椤�
	
	private int prevPage; //涓婁竴椤�
	
	private int total; //鎬绘潯鏁�
	
	private int totalPages; //鎬婚〉鏁�

	public int getPageNo() {
		return pageNo;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public void setPageNo(int pageNo) {
		//鍒ゆ柇鏄惁澶т簬鏈�澶ч〉
		if (this.pageNo > this.getTotalPages()) {
			this.pageNo = this.getTotalPages();
			return;
		}
		this.pageNo = pageNo;
	}

	public int getNextPage() {
		nextPage = this.pageNo >= this.getTotalPages() ? this.getTotalPages() : pageNo + 1;
		return nextPage;
	}

	public void setNextPage(int nextPage) {
		this.nextPage = nextPage;
	}

	public int getPrevPage() {
		prevPage = pageNo == 1 ? 1 : pageNo - 1;
		return prevPage;
	}

	public void setPrevPage(int prevPage) {
		this.prevPage = prevPage;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public int getTotalPages() {
		totalPages = (this.getTotal() - 1) / this.size + 1;
		return totalPages;
	}

	public void setTotalPages(int totalPages) {
		this.totalPages = totalPages;
	}
/*	public static void main(String[] args) {
		pageBean pageBean = new pageBean();
		pageBean.setPageNo(6);
		System.out.println(pageBean.getPageNo());
	}*/
	
}
